package com.minshenglife.zanzan.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.minshenglife.zanzan.dao.LA_AgentDao;
import com.minshenglife.zanzan.entity.eoa.LA_AGENT;
import com.minshenglife.zanzan.service.AgentService;

/**
 * 外勤员工service
 * @author jianghaibo
 *
 */
@Component
@Transactional
public class AgentServiceImpl implements AgentService {
	
	@Resource
	private LA_AgentDao agentDao;
	
	@Override
	public LA_AGENT findByCodeAndIdno(LA_AGENT agent) {
		List<LA_AGENT> list = agentDao.findByExample(agent);
		if(list != null && list.size() > 0){
			return list.get(0);
		}
		return null;
	}

	@Override
	public Long findCount() {
		Long count = agentDao.count(null);
		return count;
	}

	@Override
	public LA_AGENT findByCodeAndIdno(String empNo, String idNo) {
		LA_AGENT agent = new LA_AGENT();
		agent.setAgentCode(empNo);
		agent.setIdNo(idNo);
		List<LA_AGENT> list = agentDao.findByExample(agent);
		if(list != null && list.size() > 0){
			return list.get(0);
		}
		return null;
	}
	
}
